
\newcommand{\drafttext}{{\tiny \red{ Draft; version from \today; some things may change -- don't print}}}

%% probability and graphical models
\newcommand{\MB}{\textrm{MB}}
\newcommand{\nondesc}{\textrm{nondesc}}
\newcommand{\desc}{\textrm{desc}}
\newcommand{\anc}{\textrm{anc}}
\newcommand{\data}{\mathcal{D}}
\newcommand{\normal}{\mathcal{N}}
\newcommand{\Dobs}{\x^o}
\newcommand{\yobs}{\y^o}
\newcommand{\Phiobs}{\Phi^o}
\newcommand{\Ev}{\mathcal{E}}
%\DeclareMathOperator{\var}{V}
\newcommand{\var}{\mathbb{V}}
\newcommand{\Var}{\var}
%\DeclareMathOperator{\E}{E}
\newcommand{\E}{\mathbb{E}}
\renewcommand{\Pr}{\mathbb{P}}
\renewcommand{\P}{\operatorname{P}}
%\renewcommand{\P}{\mathbb{P}}
\usepackage{centernot}
\newcommand{\independent}{\mathrel{\perp\mspace{-10mu}\perp}}
\newcommand{\notind}{\centernot{\independent}}

\newcommand{\pre}{\mathrm{pre}}
\newcommand{\pa}{\mathrm{pa}}
\newcommand{\pap}{\pi}
\renewcommand{\ne}{\mathrm{ne}}

\newcommand{\Gauss}{\mathcal{N}}
\newcommand{\BetaDist}{\mathcal{B}}

%% optimisation
\newcommand{\Jtav}{\bar{J}_T}
\newcommand{\Jtheta}{J_{\mytheta}}
\newcommand{\J}{\mathbf{J}}
\newcommand{\Jnp}{J_{\mathrm{np}}^N}
\newcommand{\Jmsm}{J_{\mathrm{msm}}^N}
\newcommand{\Jsm}{J_{\mathrm{sm}}}
\newcommand{\Jpa}{J_{\mathrm{pa}}^N}
\newcommand{\ellsyn}{\hat{\ell}_s^N}
\newcommand{\Lhat}{\hat{L}}
\DeclareMathOperator*{\argmax}{\mathrm{argmax}}
\DeclareMathOperator*{\argmin}{\mathrm{argmin}}
\DeclareMathOperator*{\st}{subject \; to}
\DeclareMathOperator*{\maximise}{maximise}
\DeclareMathOperator*{\minimise}{minimise}

%% linear algebra
%\newcommand{\diag}{\text{diag}}
\DeclareMathOperator{\diag}{diag}
\newcommand{\zerob}{\boldsymbol{0}}
\DeclareMathOperator{\tr}{tr}
\DeclareMathOperator{\trace}{trace}
\DeclareMathOperator*{\vspan}{span}

%% integral
\newcommand{\ud}{\mathrm{d}}

%% misc
\newcommand{\rref}[1]{$\left(\ref{#1}\right)$}

%% slides
% correct for added space after math equation
\newcommand{\mathpause}{\vspace*{-\baselineskip}\pause}


% vectors
\renewcommand{\a}{\mathbf{a}}
\renewcommand{\b}{\mathbf{b}}
\renewcommand{\c}{\mathbf{c}}
\newcommand{\e}{\mathbf{e}}
\newcommand{\f}{\mathbf{f}}
\newcommand{\g}{\mathbf{g}}
\newcommand{\h}{\mathbf{h}}
\newcommand{\kk}{\mathbf{k}}
\newcommand{\m}{\mathbf{m}}
\newcommand{\n}{\mathbf{n}}
\newcommand{\p}{\mathbf{p}}
\newcommand{\q}{\mathbf{q}}
\makeatletter
\@ifundefined{r}{%
\newcommand{\r}{\mathbf{r}}}{}
\makeatother
\renewcommand{\r}{\mathbf{r}}
\newcommand{\s}{\mathbf{s}}
\renewcommand{\t}{\mathbf{t}}
\newcommand{\uu}{\mathbf{u}}
\let\Oldu\u
\renewcommand{\u}{\mathbf{u}}
\let\Oldv\v
\renewcommand{\v}{\mathbf{v}}
\newcommand{\vv}{\mathbf{v}}
\newcommand{\w}{\mathbf{w}}
\newcommand{\x}{\mathbf{x}}
\newcommand{\y}{\mathbf{y}}
\newcommand{\z}{\mathbf{z}}

% greek
\newcommand{\epsilonast}{\epsilon^{\ast}}
\newcommand{\mytheta}{\boldsymbol{\theta}}
\newcommand{\myTheta}{\boldsymbol{\Theta}}
\newcommand{\thetab}{\mytheta}
\newcommand{\etab}{\boldsymbol{\eta}}
\newcommand{\epsilonb}{\boldsymbol{\epsilon}}
\newcommand{\myalpha}{\boldsymbol{\alpha}}
\newcommand{\alphab}{\myalpha}
\newcommand{\mybeta}{\boldsymbol{\beta}}
\newcommand{\betab}{\mybeta}
\newcommand{\myphi}{\boldsymbol{\phi}}
\newcommand{\phib}{\myphi}
\newcommand{\phibhat}{\hat{\myphi}}
\newcommand{\phiobs}{\Phi^o}
%\newcommand{\mub}{\boldsymbol{\mu}}
\newcommand{\mub}{\pmb{\mu}}
\newcommand{\xib}{\boldsymbol{\xi}}
\newcommand{\lambdab}{\boldsymbol{\lambda}}
\newcommand{\lambdabhat}{\hat{\lambdab}}
\newcommand{\lambdaphi}{\lambdab_{\phib}}
\newcommand{\tphi}{\t_{\phib}}
\newcommand{\infnet}{\lambdaphi}
\newcommand{\infnethat}{\lambdab_{\phibhat}}
\newcommand{\etatheta}{\etab_{\thetab}}
\newcommand{\psib}{\boldsymbol{\psi}}
\newcommand{\mubHat}{\hat{\mub}}
\newcommand{\muHat}{\hat{\mu}}
\newcommand{\mynu}{\boldsymbol{\nu}}
\newcommand{\betaobs}{\mybeta^o}
\newcommand{\betasim}{\mybeta_{\mytheta}}
\newcommand{\thetaHat}{\hat{\thetab}}
\newcommand{\thetabHat}{\thetaHat}
\newcommand{\thetaCheck}{\boldsymbol{\check{\theta}}}
\newcommand{\thetaMLE}{\thetaHat_{\mathrm{MLE}}}
\newcommand{\thetaTilde}{\boldsymbol{\tilde{\theta}}}
\newcommand{\thetaTildeMLE}{\thetaTilde_{\mathrm{MLE}}}
\newcommand{\thetaTildeMAP}{\thetaTilde_{\mathrm{MAP}}}
\newcommand{\thetaTrue}{\mytheta^o}
\newcommand{\myzeta}{\boldsymbol{\zeta}}
\newcommand{\myxi}{\boldsymbol{\xi}}
\newcommand{\xiTrue}{\myxi^o}
\newcommand{\myomega}{\boldsymbol{\omega}}
\newcommand{\omegab}{\myomega}
\newcommand{\thetay}{\mytheta_{y}}
\newcommand{\thetaz}{\mytheta_{z}}
\newcommand{\omegaz}{\myomega_{z}}
\newcommand{\rhoy}{\rho_{\y}}
\newcommand{\fobs}{f_{\y|\mytheta}} 
\newcommand{\fpost}{f_{\mytheta |\y}} 
\newcommand{\fprior}{f_{\mytheta}} % 
\newcommand{\fprop}{f_{\thetaz}}
\newcommand{\fphi}{f_{\phib}}
\newcommand{\qphi}{q_{\phib}}

\newcommand{\Ae}{A_{\epsilon}}
\newcommand{\Be}{B_{\epsilon}}
\newcommand{\Fsc}{F_{s|\thetaz,\y}} % conditional
\newcommand{\fsc}{f_{s|\thetaz,\y}}
\newcommand{\fsj}{f_{s,\thetaz |\y}} % joint
\newcommand{\yT}{\y_T}
\newcommand{\ysim}{\y_{\mytheta}}
\newcommand{\tsim}{\t_{\mytheta}}
\newcommand{\tobs}{\t^o}

\newcommand{\rhotheta}{\rho_{\mytheta}}
\newcommand{\ftheta}{\mathbf{f}_{\mytheta}}
\newcommand{\simmodel}{g}

\newcommand{\Ind}{\mathcal{I}}
%\newcommand{\data}{y^o}

% matrices
\newcommand{\A}{\mathbf{A}}
\newcommand{\B}{\mathbf{B}}
\makeatletter
\@ifundefined{C}{%
\newcommand{\C}{\mathbf{C}}
}{}
\makeatother
\renewcommand{\C}{\mathbf{C}}
\newcommand{\D}{\mathbf{D}}
\newcommand{\F}{\mathbf{F}}
\renewcommand{\H}{\mathbf{H}}
\newcommand{\I}{\mathbf{I}}
\newcommand{\K}{\mathbf{K}}
\newcommand{\M}{\mathbf{M}}
\newcommand{\Mhat}{\mathbf{\hat{M}}}
\newcommand{\PP}{\mathbf{P}}
\newcommand{\R}{\mathbf{R}}
\renewcommand{\S}{\mathbf{S}}
\makeatletter
\@ifundefined{U}{%
\newcommand{\U}{\mathbf{U}}
}{}
\makeatother
\renewcommand{\U}{\mathbf{U}}
\newcommand{\V}{\mathbf{V}}
\newcommand{\W}{\mathbf{W}}
\newcommand{\X}{\mathbf{X}}
\newcommand{\Y}{\mathbf{Y}}
\newcommand{\Z}{\mathbf{Z}}
\newcommand{\Q}{\mathbf{Q}}
\newcommand{\EE}{\mathbf{E}}
\newcommand{\Lambdab}{\mathbf{\Lambda}}
\newcommand{\Sigmab}{\pmb{\Sigma}}
\newcommand{\Psib}{\pmb{\Psi}}
\newcommand{\SigmabHat}{\pmb{\hat{\Sigma}}}
\newcommand{\SigmabHatTheta}{\mySigmaHat_{\mytheta}}
\newcommand{\Ctheta}{\C_{\mytheta}}
\newcommand{\muHatTheta}{\mymuHat_{\mytheta}}
\newcommand{\myOmega}{\mathbf{\Omega}}
\newcommand{\Deltatheta}{\Delta_{\mytheta}}
\newcommand{\Econd}{\E_{\Phi|\mytheta}}
\newcommand{\Econdrho}{\E_{\rho|\mytheta}}
\newcommand{\Econdvrho}{\E_{\varrho|\mytheta}}
\newcommand{\Econddelta}{\E_{\Delta|\mytheta}}
\newcommand{\EconddeltaHat}{\hat{\E}_{\Delta|\mytheta}}
\newcommand{\Pcond}{\P_{\Phi|\mytheta}}
\newcommand{\Pcondrho}{\P_{\rho|\mytheta}}
\newcommand{\Pcondvrho}{\P_{\varrho|\mytheta}}
\newcommand{\Pconddelta}{\P_{\Delta|\mytheta}}
\newcommand{\PconddeltaHat}{\hat{\P}_{\Delta|\mytheta}}
\newcommand{\pcond}{p_{\Phi|\mytheta}}
\newcommand{\pcondhat}{\hat{p}_{\Phi|\mytheta}}
\newcommand{\ptheta}{p_{\mytheta}}
\newcommand{\pnoise}{p_{\text{noise}}}
%\newcommand{\pdata}{p_{\text{data}}}
\newcommand{\pdata}{p_{\ast}}
\newcommand{\pmodel}{p_{\y|\mytheta}}
\newcommand{\ellhat}{\hat{\ell}}
\newcommand{\red}[1]{\textcolor{red}{#1}}
\newcommand{\blue}[1]{\textcolor{blue}{#1}}
\newcommand{\darkgreen}[1]{\textcolor{\myGreen}{#1}}
\newcommand{\approxpropto}{\mathrel{\vcenter{
  \offinterlineskip\halign{\hfil$##$\cr
    \propto\cr\noalign{\kern2pt}\sim\cr\noalign{\kern-2pt}}}}}

\newcommand{\ind}{\mathbbm{1}}
\newcommand{\ytheta}{y_\theta}
\newcommand{\Jnce}{J^{\textrm{\tiny NCE}}}


\newcommand{\yv}[1]{\y^{(#1)}}
\newcommand{\ys}[1]{y^{(#1)}}
\newcommand{\wv}[1]{\bw^{(#1)}}
\newcommand{\zv}[1]{\z^{(#1)}}
\newcommand{\nb}[1]{n^{(#1)}}
\newcommand{\bs}[1]{b^{(#1)}}
\newcommand{\bw}{{\mathbf w}}

%\newcommand\independent{\protect\mathpalette{\protect\independenT}{\perp}}
%\def\independenT#1#2{\mathrel{\rlap{$#1#2$}\mkern2mu{#1#2}}}

\newcommand{\Xc}{\mathcal{X}}
\newcommand{\Uc}{\mathcal{U}}

\newcommand{\warning}{{\fontencoding{U}\fontfamily{futs}\selectfont\char 66\relax}}

\newcommand{\xBar}{\bar{x}}


\newcommand{\KL}{\text{KL}}
\newcommand{\freeEn}{\mathcal{F}}
\newcommand{\ELBO}{\mathcal{L}}
\newcommand{\ELBOdata}{\ELBO_{\data}}
\newcommand{\ELBOx}{\ELBO_{\x}}
\newcommand{\ELBOv}{\ELBO_{\v}}

\newcommand{\Qfam}{\mathcal{Q}}
%\newcommand{\Jf}{J_{\scaleto{\freeEn\mathstrut}{3pt}}}
\newcommand{\Jf}{J_{\freeEn}}
\newcommand{\thetabNew}{\thetab_{\text{new}}}
\newcommand{\thetabOld}{\thetab_{\text{old}}}
